public class PromotionResult {
    private final double savedAmount;
    private final SalesPromotion promotionType;

    public PromotionResult(double savedAmount, SalesPromotion promotionType) {
        this.savedAmount = savedAmount;
        this.promotionType = promotionType;
    }

    public static PromotionResult getBest(PromotionResult first, PromotionResult second) {
        return first.betterThan(second) ? first : second;
    }

    public double getSavedAmount() {
        return savedAmount;
    }

    public boolean betterThan(PromotionResult another) {
        return savedAmount > another.savedAmount;
    }

    public String formatStatement() {
        return savedAmount == 0 ? "" : String.format("%s，saving %.0f yuan%s", promotionType.getPromotionTitle(), savedAmount, StatementGenerator.DIVIDE);
    }
}
